package com.cysyz.web.modules.base.businesslog.domain;

import com.cysyz.mylib.domain.BaseEntity;
import com.cysyz.mylib.domain.annotation.Alias;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Created by jiaoyujia on 2015/2/6.
 */
@Entity
@Table(name = "FNM_SYS_BUSINESS_LOG_TARGET_ENTITY")
public class SysBusinessLogTargetEntity extends BaseEntity {
    private static final long serialVersionUID = 5454155825314635342L;

    //alias
    public static final String TABLE_ALIAS = "SysBusinessLogTargetEntity";
    public static final String ALIAS_ENTITY_CHANGED_INFO_JSON = "entityChangedInfoJson";
    public static final String ALIAS_ENTITY_NAME = "entityName";
    public static final String ALIAS_BUSINESS_LOG_ID = "businessLogId";

    //date formats


    //可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
    //columns START
    @Length(max=3000)
    @Column(name = "ENTITY_CHANGED_INFO_JSON", unique = false, nullable = false, length = 3000)
    @Alias(cn="")
    private String entityChangedInfoJson;

    @Length(max=50)
    @Column(name = "ENTITY_NAME", unique = false, nullable = false, length = 50)
    @Alias(cn="")
    private String entityName;

    @ManyToOne(cascade = {}, fetch = FetchType.LAZY)
    @JoinColumn(name = "BUSINESSLOG_ID")
    private SysBusinessLog businessLog;
    //columns END

    @Override
    public String[] businessKeys() {
        return new String[]{};
    }
    public String getEntityChangedInfoJson() {
        return this.entityChangedInfoJson;
    }

    public void setEntityChangedInfoJson(String value) {
        this.entityChangedInfoJson = value;
    }

    public String getEntityName() {
        return this.entityName;
    }

    public void setEntityName(String value) {
        this.entityName = value;
    }


    public void setBusinessLog(SysBusinessLog businessLog){
        this.businessLog = businessLog;
    }

    public SysBusinessLog getBusinessLog() {
        return businessLog;
    }
	/*vo*/









    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("EntityChangedInfoJson",getEntityChangedInfoJson())
                .append("EntityName",getEntityName())
                .append("BusinessLogId")
                .toString();
    }
}


